<?php
    class Admincp_Model_Language extends Zend_Db_Table_Abstract
    {
        protected $_name = 'language';
        protected $_primary = 'id';
        protected $_db;
        
        public function __construct()
        {
            $this->_db = Zend_Registry::get('db');
        }
        
        public function getIdNotVN()
        {
            $sql = $this->_db->select()
                            ->from($this->_name, array('id'))
                            ->where('locale <> ?', 'vi');
            $result = $this->_db->fetchAll($sql);
            return $result;
        }
        
        public function getIdByLocale($locale)
        {
            $sql = $this->_db->select()
                            ->from($this->_name, array('id'))
                            ->where('locale = ?', $locale);
            $result = $this->_db->fetchOne($sql);
            return $result;
        }
        
        public function listLanguage()
        {
            $sql = $this->_db->select()
                            ->from($this->_name, array('id','name'))
                            ->order('id ASC');
            $result = $this->_db->fetchAll($sql);
            return $result;
        }
        
        public function listLanguageFull()
        {
            $sql = $this->_db->select()
                            ->from($this->_name)
                            ->order('id ASC');
            $result = $this->_db->fetchAll($sql);
            return $result;
        }
    }
